/**
 * @project heima-leadnews
 * @author MECHREVO
 * @date 2024/1/23 10:22:10
 * @version 1.0
 */
package com.heima.Kafka.Web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/vi/kafka")
public class HelloController {

    @Autowired
    private KafkaTemplate kafkaTemplate;

    @GetMapping("/send")
    public String sendMsg(){
        kafkaTemplate.send("hello-Topic","hello.kafka");
        return "success";
    }
}
